﻿// <copyright file="NotepadPPLauncher.cs" company="Horiba Medical">
//     Copyright (c) Horiba Medical. All rights reserved.
// </copyright>
// <summary>
//     NotepadPP launcher..
// </summary>

namespace DoxyOutParser.Launcher
{
	using System.ComponentModel;
	using System.Diagnostics;
	using DoxyOutParser.Launcher;

	/// <summary>
	/// Launches NotepadPP with a specified file at a specified line.
	/// </summary>
	internal class NotepadPPLauncher
	{
		/// <summary>
		/// Prevents a default instance of the NotepadPPLauncher class from being created.
		/// </summary>
		private NotepadPPLauncher()
		{
		}

		/// <summary>
		/// Launches NotepadPP with the appropriate arguments.
		/// </summary>
		/// <param name="fileName">The file to open.</param>
		/// <param name="line">The line to point to.</param>
		public static void Launch(string fileName, string line)
		{
			ProcessStartInfo startInfo = new ProcessStartInfo();
			startInfo.FileName = "C:\\Program Files\\Notepad++\\Notepad++.exe";
			startInfo.WindowStyle = ProcessWindowStyle.Hidden;
			startInfo.Arguments = fileName + " -n" + line;
			try
			{
				Process.Start(startInfo);
			}
			catch (System.ComponentModel.Win32Exception exception)
			{
				throw new Win32Exception(exception.Message + ": " + startInfo.FileName);
			}
		}
	}
}
